package pack0701;
//throws方法处理异常
import java.util.InputMismatchException;
import java.util.Scanner;

public class Test1 {
    public void print() throws InputMismatchException{  //print 打印的意思
        Scanner scan =new Scanner(System.in);
        System.out.println("请输入第一个数: ");
        int a= scan.nextInt();
        System.out.println("请输入第二个数: ");
        int b= scan.nextInt();

        System.out.println("除法的结果: "+a/b);

        System.out.println("计算完毕");
    }
    public void sing(){
        try{
            print();
        }catch(InputMismatchException e){
            System.out.println("抓住了输入不匹配异常");
        }
    }

    public static void main(String[] args) {
        Test1 t=new Test1();
        try{
            t.sing();
        }catch(ArithmeticException e){
            System.out.println("抓住了数学异常");

        }
        System.out.println("aaaaaaaaaaaa");
    }

}
